#!/usr/bin/python3
import sys
import re
import math

def part1():
    print('part 1')
    times, distances = [re.split(r'\s+', line.strip()) for line in sys.stdin.readlines()]
    pairs = list(zip([int(n) for n in times[1:]], [int(n) for n in distances[1:]]))
    print(times)
    print(distances)
    print(pairs)
    product = 1
    for time, dist in pairs:
        ways = 0
        for h in range(time):
            reach = h * (time - h)
            if reach > dist:
                ways += 1
        print(ways)
        product *= ways
    print(product)

def part2():
    print('part 2')
    time, dist = [int(line.split(':')[1].replace('\n', '').replace(' ', '')) for line in sys.stdin.readlines()]
    print(time, dist)
    ways = 0
    for h in range(time):
        reach = h * (time - h)
        if reach > dist:
            ways += 1
    print(ways)

if sys.argv[1] in '1':
    part1()
else:
    part2()
